package com.zmq.pic.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * 人物群组 entity. 
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pic_figure_group")
public class PicFigureGroup extends com.zmq.pic.entity.BaseEntity implements
		java.io.Serializable {

	private static final long serialVersionUID = -5011587716673031352L;
	// Fields

	private Long id;
	/**
	 * 群组名称
	 */
	private String name;
	private Set<PicFigure> picFigures = new HashSet<PicFigure>(0);

	// Constructors

	/** default constructor */
	public PicFigureGroup() {
	}

	/** full constructor */
	public PicFigureGroup(String name, Set<PicFigure> picFigures) {
		this.name = name;
		this.picFigures = picFigures;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "increment")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "NAME", length = 64)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "picFigureGroup")
	public Set<PicFigure> getPicFigures() {
		return this.picFigures;
	}

	public void setPicFigures(Set<PicFigure> picFigures) {
		this.picFigures = picFigures;
	}

	@Override
	public String toString() {
		return "PicFigureGroup [id=" + id + ", name=" + name + ", picFigures="
				+ picFigures + "]";
	}

}